//
//  FileTableViewCell.m
//  ApexCardSDK_Demo_iOS
//
//  Created by 谭永明 on 16/9/24.
//  Copyright © 2016年 珠海艾派克科技股份有限公司. All rights reserved.
//

#import "FileTableViewCell.h"

@interface FileTableViewCell ()

@property (weak, nonatomic) IBOutlet UILabel *fileNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *sizeLabel;
@property (weak, nonatomic) IBOutlet UILabel *progressLabel;

@end

@implementation FileTableViewCell

-(void)setFile:(MCCardFile *)file {
    self.fileNameLabel.text = file.name;

    if (!self.shouldShowProgress) {
        self.sizeLabel.text = @"";
        self.progressLabel.text = [NSString stringWithFormat:@"%ld Kb", file.length / 1024];
    } else {
        self.sizeLabel.text = [NSString stringWithFormat:@"%ld Kb", file.length / 1024];
        CGFloat progress = 1.0 * file.data.length / file.length;
        self.progressLabel.text = [NSString stringWithFormat:@"%.2f %%", 1.0 * progress * 100];
    }
    
}

@end
